package com.cyzy.server.controller.user;


import com.cyzy.common.result.Result;
import com.cyzy.pojo.dto.HuntCardUpdateDTO;
import com.cyzy.pojo.dto.RecruitCardUpdateDTO;
import com.cyzy.pojo.entity.HuntCard;
import com.cyzy.pojo.entity.RecruitCard;
import com.cyzy.pojo.vo.HuntCardVO;
import com.cyzy.pojo.vo.RecruitCardVO;
import com.cyzy.server.dao.HuntCardDao;
import com.cyzy.server.dao.RecruitCardDao;
import com.cyzy.server.service.HuntCardService;
import com.cyzy.server.service.RecruitCardService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/user/card/update")
@Slf4j
public class UpdateController {


    @Autowired
    private RecruitCardService recruitCardService;

    @Autowired
    private RecruitCardDao recruitCardDao;

    @Autowired
    private HuntCardService huntCardService;

    @Autowired
    private HuntCardDao huntCardDao;




    /**
     * 修改已发布求职帖子的信息
     */
    @PutMapping("/job")
    public Result updateHuntCardInfo(Integer id,@RequestBody HuntCardUpdateDTO huntCardUpdateDTO){
        HuntCard huntCard = huntCardService.updateHuntCardById(id, huntCardUpdateDTO);
        return Result.success(huntCard);
    }

    /**
     * 修改已发布招募帖子的信息
     */
    @PutMapping("/recruit")
    public Result updateRecruitCardInfo(Integer id,@RequestBody RecruitCardUpdateDTO recruitCardUpdateDTO){
        RecruitCard recruitCard = recruitCardService.updateRecruitCardById(id, recruitCardUpdateDTO);
        return Result.success(recruitCard);
    }
}
